####Autocratic Revolving Doors####
####Roman-Gabriel Olar####
####Created on 17/02/2022####
####Last modified on 12/10/2024####

# load the library
library(forcats)
library(ggplot2)
library(haven) 
library(foreign)
library(ggthemes)
library(tidyverse)
library(dplyr)
library(ggpubr)

##Set wd
setwd("C:/Users/Administrator/Dropbox/Papers/ARD Elites/Draft/ARD Observational/PoP/Final submission/Data")
##Load data
df<-read_dta("C:/Users/olarr/Dropbox/Papers/ARD Elites/Data/Analysis/Figure3.dta")
df2<-read_dta("C:/Users/olarr/Dropbox/Papers/ARD Elites/Data/Analysis/Figure2.dta")


#### ARD Cohorts ####

### Figure 2 ###
df2 %>%
  mutate(gwf_country = fct_reorder(gwf_country, desc(prop_dem_ARD))) %>%
  ggplot( aes(x=gwf_country, y=prop_dem_ARD)) +
  geom_bar(stat="identity", alpha=.8, width=.5) +
  coord_flip() +
  xlab("") + scale_y_continuous(name="Proportion of democratic elites that are ARD", breaks=seq(0,.50,.05)) +
  theme_bw() +  theme(axis.text.y = element_text(size =9, angle = 360,hjust=1,vjust=0.5))


### Figure 3 ###
df %>%
  mutate(gwf_country = fct_reorder(gwf_country, desc(prop_ARD))) %>%
  ggplot( aes(x=gwf_country, y=prop_ARD)) +
  geom_bar(stat="identity", alpha=.8, width=.5) +
  coord_flip() +
  xlab("") + scale_y_continuous(name="Proportion of ARD elites from autocratic cohort", breaks=seq(0,.35,.05)) +
  theme_bw() +  theme(axis.text.y = element_text(size =9, angle = 360,hjust=1,vjust=0.5))


